package com.crazymo.binderpool;

import android.os.IBinder;
import android.os.RemoteException;

import com.crazymo.binderpool.exception.MoErrorEnum;
import com.crazymo.binderpool.exception.MoException;

import static com.crazymo.binderpool.BinderPool.*;


/******************************************************************
 * @Copyright : (C), 2001-2021, ZHEJIANG DAHUA TECHNOLOGY CO.,LTD
 * @FileName : BinderPoolImpl
 * @Author : 224967  Crazy.Mo
 * @Date : 2022/2/11 16:15
 * @Description :    
 * @History :
 * <author>  <time>  <version>   <desc>
 * 224967    修改时间    版本号       描述
 ******************************************************************/


public class BinderPoolImpl extends IBinderPool.Stub {

    @Override
    public IBinder queryBinder(int binderCode) throws RemoteException {
        IBinder binder=null;
        switch (binderCode){
            case SECURITY_CODE:
                binder=new SecurityCenterImpl();
                break;
            case COMPUTE_CODE:
                binder=new ComputeImpl();
                break;
            default:
                throw new MoException("Unknown binderCode ", MoErrorEnum.PARAM_IS_ILLEGAL);
        }
        return binder;
    }
}
